package com.jtpay.payresulthelper.util;

import android.text.TextUtils;

public class StringUtil {
    //字符串是空或者null
    public static boolean isEmptyStr(String source) {
        if (TextUtils.isEmpty(source)) {
            return true;
        }
        if ("null".equals(source)) {
            return true;
        }
        return false;
    }

    //订单列表时间戳 time 如 11:22
    public static String getTime(String order, String time) {
        String out = order.substring(0, 8);
        time = time.trim();
        time = time.replaceAll(":", "");
        out = out + time + "00";
        return out;
    }

    //获取订单详情时间戳，如 2018-09-14 18:46
    public static String getTime(String time) {
        String out = time.replaceAll("-", "").replaceAll(":", "").replaceAll(" ", "");
        out = out + "00";
        return out;
    }

    //根据Ali订单号获取日期
    public static String getDate(String order) {
        String out = order.substring(0, 8);
        return out;
    }
}
